/*
*	ID : Pallab
* 	PROG : D
* 	LANG : C++
* 	2012-12-13-00.10.25 Thursday
*
* 	"I have not failed, I have just found 10000 ways that won't work.
*/
#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <numeric>
#include <stack>
#include <functional>
#include <bitset>
#include <iomanip>
#include <chrono>
#include <unordered_set>
#include <unordered_map>
#include <array>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define foR(i1,st,ed) for(int i1 = st , j1 = ed ; i1 < j1 ; ++i1 )
#define fo(i1,ed) foR( i1 , 0 , ed )
#define foE(i1,st,ed) foR( i1, st, ed+1 )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) )
#define line puts("")

inline void wait(double seconds) {
    double endtime = clock() + (seconds * CLOCKS_PER_SEC);
    while (clock() < endtime) {
        ;
    }
}
template<class T>
inline T fastIn() {
    register char c=0;
    register T a=0;
    bool neg=false;
    while(c<33)c=getchar();
    while(c>33) {
        if(c=='-') {
            neg=true;
        } else {
            a= (a*10)+(c-'0');
        }
        c=getchar();
    }
    return neg?-a:a;
}
const int MX=401;
//N row
//M col
//K
int N,M,K;
char G[MX][MX];
inline void read() {
    N=fastIn<int>(),M=fastIn<int>(),K=fastIn<int>();
    fo(i,N) {
        gets(G[i]);
    }
}
int rc_count[MX][MX];
inline void f1() {
    fo(i,N) {
        fo(j,M) {
            int a=(G[i][j]=='a'?1:0);
            if(i-1>=0)a+=rc_count[i-1][j];
            if(j-1>=0)a+=rc_count[i][j-1];
            if(i-1>=0&&j-1>=0)a-=rc_count[i-1][j-1];
            rc_count[i][j]=a;
        }
    }
}
inline int solver(int r1, int c1, int r2, int c2) {
    int res=rc_count[r2][c2];
    if(r1-1>=0)res-=rc_count[r1-1][c2];
    if(c1-1>=0)res-=rc_count[r2][c1-1];
    if(r1-1>=0&&c1-1>=0)res+=rc_count[r1-1][c1-1];
    return res;
}

inline int solve(int r1, int r2) {
    vector<int> lst[26];
    fo(c2,M) {
        if(G[r1][c2]==G[r2][c2]) {
            lst[G[r2][c2]-'a'].pb(c2);
        }
    }
    int ans=0;
    for(int z=0; z<26; ++z) {
        vector<int>&v=lst[z];
        int sz=SZ(v);
        for(int p=0,q=1; q<sz; ) {
            int sum=solver(r1,v[p],r2,v[q]);
            if(p==q)++q;
            else if(sum<=K){
                ans+=q-p;
                ++q;
            }else ++p;
        }
    }return ans;
}
inline void proc() {
    f1();
    Int cnt=0;
    fo(r1,N) {
        foR(r2,r1+1,N) {
            cnt+=solve(r1,r2);
        }
    }
    cout<<cnt<<'\n';
}
int main() {
    int kase = 1;
#if defined( xerxes_pc )
    if (!freopen("in1", "r", stdin))
        puts("error opening file in "), assert(0);
    kase = 1;
#else
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    fo(i,kase) {
        read();
        proc();
    }
    return 0;
}
